<template>
  <div class="container">
    <!-- 头部信息区 -->
    <div class="gradient-header">
      <div class="header-bg-circle"></div>

      <div class="header-top">
        <div class="header-left">
          <span class="case-id">个案ID: CR20231025-087</span>
          <h1 class="title">危机个案跟进详情</h1>
          <span class="risk-level">
            <i class="fas fa-exclamation-triangle"></i> 高风险个案 -
            保密协议打破
          </span>
        </div>
        <span class="update-time">
          <i class="fas fa-clock"></i> 最后更新: 2023-10-26 14:35
        </span>
      </div>

      <div class="info-grid">
        <div class="info-item">
          <p class="info-label">员工姓名</p>
          <p class="info-value">张明华</p>
        </div>
        <div class="info-item">
          <p class="info-label">所属部门</p>
          <p class="info-value">技术研发部</p>
        </div>
        <div class="info-item">
          <p class="info-label">员工编号</p>
          <p class="info-value">TECH-2020-087</p>
        </div>
        <div class="info-item">
          <p class="info-label">联系电话</p>
          <p class="info-value">138****5689</p>
        </div>
      </div>
    </div>

    <!-- 跟进时间轴 -->
    <div class="timeline-container">
      <div class="timeline-header">
        <span class="header-icon">
          <i class="fas fa-history"></i>
        </span>
        <h2>个案跟进流程</h2>
      </div>

      <div class="timeline-content">
        <!-- 阶段1: 电话中心已接单 -->
        <div class="timeline-item">
          <div class="timeline-icon green">
            <i class="fas fa-check"></i>
          </div>
          <div class="timeline-card">
            <div class="card-header">
              <h3>电话中心已接单</h3>
              <span class="time">2023-10-25 09:15</span>
            </div>
            <span class="status-badge completed">已完成</span>
            <div class="card-person">
              <div class="avatar">李</div>
              <div class="person-info">
                <p class="name">李思思</p>
                <p class="role">危机干预专员</p>
              </div>
            </div>
          </div>
        </div>

        <!-- 阶段2: 已安排咨询师跟进 -->
        <div class="timeline-item">
          <div class="timeline-icon green">
            <i class="fas fa-check"></i>
          </div>
          <div class="timeline-card">
            <div class="card-header">
              <h3>已安排咨询师跟进</h3>
              <span class="time">2023-10-25 10:30</span>
            </div>
            <span class="status-badge completed">已完成</span>
            <div class="card-person">
              <div class="avatar">王</div>
              <div class="person-info">
                <p class="name">王丽娟</p>
                <p class="role">资深心理咨询师</p>
              </div>
            </div>
          </div>
        </div>

        <!-- 阶段3: 咨询师跟进中 -->
        <div class="timeline-item">
          <div class="timeline-icon blue">
            <i class="fas fa-sync-alt"></i>
          </div>
          <div class="timeline-card">
            <div class="card-header">
              <h3>咨询师跟进中</h3>
              <span class="time">2023-10-25 至今</span>
            </div>
            <span class="status-badge in-progress">进行中</span>

            <div class="feedback">
              <div class="feedback-header">
                <i class="fas fa-comment-medical"></i>
                <span>咨询师反馈内容</span>
              </div>
              <p class="feedback-content">
                "员工目前处于严重抑郁状态，存在明确自杀意念但无即刻计划。已与员工签订安全协议，
                紧急联系人（配偶）已介入提供支持。建议：1）启动药物治疗评估；2）暂停工作两周；
                3）每日随访监测风险。"
              </p>
            </div>

            <div class="card-person">
              <div class="avatar">王</div>
              <div class="person-info">
                <p class="name">王丽娟</p>
                <p class="role">资深心理咨询师</p>
              </div>
            </div>
          </div>
        </div>

        <!-- 阶段4: 咨询师评估风险关闭 -->
        <div class="timeline-item">
          <div class="timeline-icon gray">
            <i class="far fa-clock"></i>
          </div>
          <div class="timeline-card">
            <div class="card-header">
              <h3>咨询师评估风险关闭</h3>
            </div>
            <span class="status-badge pending">待进行</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "CrisisCaseDetail",
  mounted() {
    // 添加卡片悬停效果
    const cards = document.querySelectorAll(".timeline-card");
    cards.forEach((card) => {
      card.addEventListener("mouseenter", function () {
        this.style.transform = "translateY(-3px)";
        this.style.boxShadow = "0 10px 25px rgba(0, 0, 0, 0.1)";
      });

      card.addEventListener("mouseleave", function () {
        this.style.transform = "";
        this.style.boxShadow = "";
      });
    });
  },
};
</script>

<style scoped>
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap");
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css");

.container {
  font-family: "Noto Sans SC", sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
  min-height: 100vh;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* 头部样式 */
.gradient-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 32px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.header-bg-circle {
  position: absolute;
  top: -48px;
  right: -32px;
  width: 192px;
  height: 192px;
  background-color: white;
  opacity: 0.1;
  border-radius: 50%;
}

.header-top {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  position: relative;
}

@media (min-width: 768px) {
  .header-top {
    flex-direction: row;
    align-items: center;
  }
}

.header-left {
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .header-left {
    margin-bottom: 0;
  }
}

.case-id {
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 4px 16px;
  border-radius: 9999px;
  font-size: 14px;
  margin-bottom: 8px;
}

.title {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 8px;
}

.risk-level {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background-color: rgba(239, 68, 68, 0.9);
  border-radius: 9999px;
  font-weight: 500;
  font-size: 14px;
  margin-top: 12px;
}

.risk-level i {
  margin-right: 8px;
}

.update-time {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  font-weight: 500;
  font-size: 14px;
  margin-top: 16px;
}

@media (min-width: 768px) {
  .update-time {
    margin-top: 0;
  }
}

.update-time i {
  margin-right: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .info-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.info-item {
  margin-bottom: 0;
}

.info-label {
  font-size: 14px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.info-value {
  font-size: 18px;
  font-weight: 500;
}

/* 时间轴样式 */
.timeline-container {
  background-color: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  margin-bottom: 40px;
}

.timeline-header {
  background-color: #f9fafb;
  padding: 24px 32px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
}

.header-icon {
  width: 40px;
  height: 40px;
  background-color: #3b82f6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-right: 16px;
}

.timeline-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.timeline-content {
  padding: 32px;
  position: relative;
}

.timeline-content::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 44px;
  width: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  z-index: 1;
}

.timeline-item {
  position: relative;
  margin-bottom: 48px;
  padding-left: 96px;
}

.timeline-icon {
  position: absolute;
  left: 32px;
  top: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  z-index: 2;
}

.timeline-icon.green {
  background-color: #10b981;
}

.timeline-icon.blue {
  background-color: #3b82f6;
}

.timeline-icon.gray {
  background-color: #d1d5db;
}

.timeline-card {
  background-color: #f9fafb;
  border-radius: 12px;
  padding: 24px;
  border-left: 4px solid #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 20px;
  font-weight: 700;
}

.time {
  color: #1d4ed8;
  font-weight: 500;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 15px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 16px;
}

.status-badge.completed {
  background-color: #dcfce7;
  color: #166534;
}

.status-badge.in-progress {
  background-color: #dbeafe;
  color: #1e40af;
}

.status-badge.pending {
  background-color: #fef3c7;
  color: #92400e;
}

.feedback {
  background-color: #dbeafe;
  border-radius: 8px;
  padding: 20px;
  border-left: 4px solid #3b82f6;
  margin: 24px 0;
}

.feedback-header {
  display: flex;
  align-items: center;
  color: #1d4ed8;
  font-weight: 600;
  margin-bottom: 12px;
}

.feedback-header i {
  margin-right: 12px;
}

.feedback-content {
  color: #1f2937;
  line-height: 1.7;
}

.card-person {
  display: flex;
  align-items: center;
  padding-top: 16px;
  border-top: 1px dashed #e5e7eb;
  margin-top: 16px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #a855f7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  margin-right: 12px;
}

.name {
  font-weight: 600;
}

.role {
  font-size: 14px;
  color: #6b7280;
}
</style>
